package com.ly.consumer.service.impl;

import com.ly.consumer.mapper.ConsumerMapper;
import com.ly.consumer.service.ConsumerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class ConsumerServiceImpl implements ConsumerService {

    @Autowired
    private ConsumerMapper consumerMapper;
    @Override
    public Map queryTimeTypeByTime(String month, String timeSlot) {
        return consumerMapper.queryTimeTypeByTime(month,timeSlot);
    }

    @Override
    public List<Map> queryDataByTime(String month, String startTime, String endTime) {
        List<Map> list = new ArrayList<>();

        Map map1 = new HashMap();
        map1.put("id","67");
        map1.put("type","1");
        map1.put("value","1");
        map1.put("timeSlot","8:00");
        map1.put("month","03,06,09,10");
        map1.put("timeSlotDate","08:00:00");

        list.add(map1);


        Map map2 = new HashMap();
        map2.put("id","66");
        map2.put("type","1");
        map2.put("value","1");
        map2.put("timeSlot","7:30");
        map2.put("month","03,06,09,10");
        map2.put("timeSlotDate","07:30:00");

        list.add(map2);
        return list;
    }

    @Override
    public int insertTestLog(List<Map> list) {
        return consumerMapper.insertTestLog(list);
    }

    @Override
    public int insertAreaTest() {
        List<Map> list  = new ArrayList<>();
        for (int i = 0; i < 3 ; i++) {
            Map map = new HashMap();
            map.put("areaName","12");
            map.put("areaAddress","32");
            map.put("areaLongitude","22");
            map.put("areaLatitude","33");
            map.put("deviceIds","33");
            map.put("pictureUrl","44");
            map.put("provinceId","44");
            map.put("cityId","123");
            map.put("countyId","321");
            map.put("deptId","231");
            map.put("delflag","2321");
            list.add(map);
        }
        return consumerMapper.insertAreaTest(list);
    }
}
